import datetime


class BaseConfig:  # 基本配置类
    USERNAME = "root"
    PASSWORD = "czx123456"  # 每个人设置的名字和账号会不同，这里是自己设定的账号密码
    HOST = '47.100.68.129'
    PORT = '3306'
    DATABASE = 'stock'
    DB_URI = 'mysql+pymysql://{}:{}@{}:{}/{}?charset=utf8mb4'.format(USERNAME, PASSWORD, HOST, PORT, DATABASE)
    SQLALCHEMY_DATABASE_URI = DB_URI
    SQLALCHEMY_TRACK_MODIFICATIONS = True
    # SQLALCHEMY_NATIVE_UNICODE = 'utf8'
    SQLALCHEMY_RECORD_QUERIES = True
    SQLALCHEMY_ECHO = False
    # SQLALCHEMY_POOL_SIZE = 300
    # SQLALCHEMY_POOL_TIMEOUT = 100
    # SQLALCHEMY_POOL_RECYCLE = 1600
    # SQLALCHEMY_MAX_OVERFLOW = 100
    SQLALCHEMY_ENGINE_OPTIONS = {"pool_pre_ping": True, 'max_overflow': 100,"pool_size":300,'pool_timeout':100,'pool_recycle':1600}

    # CHROMEDRIVER_PATH = '/usr/bin/chromedriver'
    WINDOW_SIZE = "1920,1080"

    # 定时任务开关
    SCHEDULER_API_ENABLED = True
    SCHEDULER_TIMEZONE = 'Asia/Shanghai'

    PERMANENT_SESSION_LIFETIME = datetime.timedelta(hours=1)

    #  行业黑名单
    CUSTOM_INDUSTRY_BLACK = ['保险', '家电行业', '物流行业', '纺织服装', '铁路公路', '综合行业', '教育', '交运设备', '文化传媒', '包装材料'
        , '房地产开发', '旅游酒店', '银行', '钢铁行业', '证券', '船舶制造', '橡胶制品', '房地产服务', '塑料制品', '工程咨询服务'
        , '环保行业', '石油行业', '航运港口', '采掘行业', '水泥建材', '商业百货', '装修建材', '造纸印刷', '贸易行业'
        , '家用轻工', '装修装饰', '中药', '公用事业', '航空机场', "美容护理"
                             ]

    #  行业黑名单
    CUSTOM_CONCEPT_BLACK = ['HS300_', 'MSCI中国', '证金持股', '富时罗素', '标准普尔', '标准普尔', '上证180_', '沪股通', 'AH股', '上证50_', '融资融券'
                            ]
    # 股票黑名单
    CUSTOM_STOCK_BLACK = []

    # 钉钉的webhook
    DINGTALK_WEBHOOK = "https://oapi.dingtalk.com/robot/send?access_token=56ef2f6b056d894bf38615b5042efe63f7370b4e9bdc9a298c3f1f62981c943c"


class DevelopmentConfig(BaseConfig):
    '''
    本地配置
    '''
    ENV = 'development'
    DEBUG = True
    HOST = '47.100.68.129'
    # SQLALCHEMY_ECHO = True
    CHROMEDRIVER_PATH = r'C:\Users\surface\AppData\Local\Programs\Python\Python38\chromedriver'


class ProductionConfig(BaseConfig):
    '''
    P环境配置
    '''
    ENV = 'production'
    CHROMEDRIVER_PATH = '/usr/bin/chromedriver'
    HOST = '47.100.68.129'


config = {
    'dev': DevelopmentConfig,
    'prd': ProductionConfig,
    'default': ProductionConfig
}
